<template>
  <div class="advisory">
      <!-- <div class="advisory1">
         <el-carousel height="359px" indicator-position='none'>
                  <el-carousel-item v-for="(item,index) in newslist4" :key="index">
                      <nuxt-link target="_blank" :to="'/post/' + item.pid">
                    <div class="newsdetailtitle">
                      <img :src="item.thumbnail" alt="">
                      <div class="info">
                        <span>{{item.name}}</span>
                       </div>
                    </div>
                      </nuxt-link>
                  </el-carousel-item>
          </el-carousel>
      </div> -->
      <div class="addbanner">
        <!-- <img src="http://img3.tqcaifu.com/titleadd/titleguanggao2.png" alt=""> -->
        <img src="http://img3.tqcaifu.com/img/linshi2.jpg" alt="">

      </div>
      <div>
        <el-row :gutter="10" class="checktitle">
          <el-col :span="16">
              <div class="checkbox1">
                <!-- 
                    财经头条
                    宏观新闻
                    财经新闻
                    市场新闻
                    投资策略
                    信托资管
                    私募股权
                    契约基金
                 -->
                <el-radio-group v-model="radio" @change="changeradio">
                  <el-radio-button label="财经头条"></el-radio-button>
                  <el-radio-button label="宏观新闻"></el-radio-button>
                  <el-radio-button label="财经新闻"></el-radio-button>
                  <el-radio-button label="市场新闻"></el-radio-button>
                  <el-radio-button label="投资策略"></el-radio-button>
                  <el-radio-button label="信托资管"></el-radio-button>
                  <el-radio-button label="私募股权"></el-radio-button>
                  <el-radio-button label="契约基金"></el-radio-button>
                </el-radio-group>
              </div>
              <div class="researchleft">
                  <newslist3 title="" :newslist="firstNews"></newslist3>                  
              </div>
              <div class="fenye">
                  <el-pagination
                    @current-change="handleCurrentChange"
                    :page-size="7"
                    layout="total, prev, pager, next, jumper"
                    :total="total">
                  </el-pagination>
              </div>  
          </el-col> 
           <el-col :span="8">
              <div>
                  <contactus2></contactus2>
                  <!-- <newslist2></newslist2> -->
                  <!-- <post1 :productlist="productlist"></post1> -->
              </div>
          </el-col>
       </el-row>
      </div>
 
  </div>
</template>

<script>
import api from '../../../static/js/api.js'
import asyncApi from '../../../static/js/asyncApi.js'
import contactus2 from "../../../components/contactus2";
import newslist3 from "../../../components/newslist3";
import newslist2 from "../../../components/newslist2";
import post1 from "../../../components/post1";
export default {
  components:{
        contactus2,
        newslist3,
        newslist2,
        post1
    },
  data() {
    return{
      radio:"投资"
    }
  },
  methods: {
    handleCurrentChange(val){
      api.getCategoryPost({categoryName:this.radio,page:val,pageSize:"7",orderBy:"createtime",orderByType:"desc"}).then((res)=>{
        this.firstNews = res.data.list
      })
    },
    changeradio(val){
      //  api.getTagPost({tagName:val,page:"1",pageSize:"7",orderBy:"createtime",orderByType:"desc"}).then((res)=>{
      //   this.firstNews = res.data.list,
      //   this.total =  res.data.total
      // })
      switch (val) {
          case "财经头条":
              window.location.href = "http://www.tqcaifu.com/column/caijingtoutiao"
            break;
          case "宏观新闻":
             window.location.href = "http://www.tqcaifu.com/column/hongguanxinwen"
            break;
          case "财经新闻":
             window.location.href = "http://www.tqcaifu.com/column/caijingxinwen"
            break;
          case "市场新闻":
             window.location.href = "http://www.tqcaifu.com/column/shichangxinwen"
            break;
          case "投资策略":
           window.location.href = "http://www.tqcaifu.com/column/touzicelue"
            break;
          case "信托资管":
            window.location.href = "http://www.tqcaifu.com/column/xintuoziguan"
            break;
          case "私募股权":
            window.location.href = "http://www.tqcaifu.com/column/simuguquan"
            break;
          case "契约基金":
            window.location.href = "http://www.tqcaifu.com/column/qiyuezijin"
            break;
          default:
           window.location.href = "http://www.tqcaifu.com/column/caijingtoutiao"
        }
    } 
  },
  mounted:function(){
    
   var id = this.$route.params.id
    switch (id) {
      case "caijingtoutiao":
        this.radio = "财经头条";
        break;
      case "hongguanxinwen":
        this.radio = "宏观新闻";
        break;
      case "caijingxinwen":
        this.radio = "财经新闻";
        break;
      case "shichangxinwen":
        this.radio= "市场新闻";
        break;
      case "touzicelue":
        this.radio = "投资策略";
        break;
      case "xintuoziguan":
        this.radio = "信托资管";
        break;
      case "simuguquan":
        this.radio = "私募股权";
        break;
       case "qiyuezijin":
        this.radio = "契约基金";
        break;
      default:
        this.radio = "财经头条";
    }
  },
  async asyncData (context) {
    var id = context.params.id;   
    var title = '新闻列表-天沁财富';
    var keywords = '';
    var description = '';

      switch (id) {
      case "caijingtoutiao":
        id = "财经头条";
        title = '财经头条_金融头条-天沁财富';
        keywords = '财经头条，金融头条';
        description = '财经头条为您提供最全的金融头条，发掘海量信息中的投资价值。';
        break;
      case "hongguanxinwen":
        id = "宏观新闻";
        title = '宏观经济政策_宏观经济分析_宏观经济新闻_-天沁财富';
        keywords = '宏观经济，宏观经济政策，宏观经济分析，宏观经济新闻';
        description = '天沁财富宏观经济频道提供国内外宏观经济数据、宏观经济分析，宏观经济政策解读。';
        break;
      case "caijingxinwen":
        id = "财经新闻";
        title = '财经新闻_财经资讯-天沁财富';
        keywords = '财经新闻，财经资讯';
        description = '财经资讯为金融投资者提供最新的财经新闻，最全的金融新闻，了解投资市场行情，为投资决策作为依据。';
        break;
      case "shichangxinwen":
        id = "市场新闻";
        title = '金融市场新闻-天沁财富';
        keywords = '市场新闻，金融市场新闻';
        description = '最新的金融市场新闻，独家金融市场分析，第一时间解读金融市场观点，报道金融市场新闻事件。';
        break;
      case "touzicelue":
        id = "投资策略";
        title = '股权投资策略_基金投资策略_信托投资策略-天沁财富';
        keywords = '股权投资策略，基金投资策略，信托投资策略';
        description = '投资策略分析，讲解股权投资策略，解读基金投资策略，信托投资，为投资者进行投资策略指导。';
        break;
      case "xintuoziguan":
        id = "信托资管";
        title = '信托基金_信托投资_信托融资-天沁财富';
        keywords = '信托基金，信托投资，信托融资';
        description = '信托基金投资汇聚最新的信托基金研究，信托融资新闻，解读信托投资的最新动态。';
        break;
      case "simuguquan":
        id = "私募股权";
        title = '私募股权基金_私募股权投资-天沁财富';
        keywords = '私募股权，私募基金，私募股权基金，私募股权投资';
        description = '私募股权频道提供最新的私募基金、私募股权投资策略和私募股权基金新闻资讯，帮助私募股权基金投资者进行策略分析和投资决策。';
        break;
       case "qiyuezijin":
        id = "契约基金";
        title = '私募基金_基金定投_基金投资-天沁财富';
        keywords = '私募基金，基金定投，基金投资';
        description = '私募基金以最新的基金定投策略，最全的基金投资报告，为私募基金投资者进行基金投资时';
        break;
      default:
        id = "财经头条";
    } 
    let [data1,data2,data6,data7] = await Promise.all([
       asyncApi.asyncGetCategoryPost({categoryName:id,page:"1",pageSize:"7",orderBy:"createtime",orderByType:"desc"}),
       //asyncApi.asyncGetCategoryPost({categoryName:"财经头条",page:"1",pageSize:"6",orderBy:"createtime",orderByType:"desc"}),
       asyncApi.asyncGetCategoryPost({page:"2",pageSize:"3",orderBy:"readNum",orderByType:"desc"}),    
       asyncApi.asyncGetCategoryPost({page:"1",pageSize:"5",orderBy:"weigh",orderByType:"desc"}),
       asyncApi.asyncgetProduct({page:"1",pageSize:"5"}),
    ])
    return {
      firstNews: data1.data.data.list,
      zuire: data2.data.data.list,
      newslist4:data6.data.data.list,
      total:data1.data.data.total,
      productlist:data7.data.data.list,
      title:title,
      keywords:keywords,
      description:description
      
    }
 },
 head () {
    return {	
      title: this.title,
      meta: [
         { hid:"keywords", name: 'keywords', content: this.keywords},
         { hid:"description", name: 'description', content: this.description}
      ]
    }
  }
};
</script>


<style scoped>
.addbanner{
  width: 100%;
  margin-top: 10px;
}
.addbanner img{
  width: 100%;
}
.fenye{
  width: 100%;
  background: white;
  text-align: center;
  padding: 20px 0;
}
.checkbox1{
  margin-bottom: -10px;
}
.newsdetailtitle{
  height: 100%;
  width: 100%;
  position: relative;
}
.newsdetailtitle img{
  height: 100%;
  width: 100%;
}
.newsdetailtitle .info{
  position: absolute;
  bottom: 0;
  right: 0px;
  width: 100%;
  
}
.newsdetailtitle .info span{
  height: 60px;
  padding: 0 30px;
  display: inline-block;
  line-height: 60px;
  background: rgba(0,0,0, 0.5);
    background: -webkit-linear-gradient(rgba(255,255,255,.1),rgba(0,0,0,.5));  
        background: -o-linear-gradient(rgba(255,255,255,.1),rgba(0,0,0,.5));  
        background: -moz-linear-gradient(rgba(255,255,255,.1),rgba(0,0,0,.5));  
        background: -mos-linear-gradient(rgba(255,255,255,.1),rgba(0,0,0,.5));  
        background: linear-gradient(rgba(255,255,255,.1),rgba(0,0,0,.5));  

  color: white;
  font-size: 20px;
  width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.advisory{
  width: 1200px;
  margin: 0 auto;
}
.advisory1{
  margin-top: 10px;
  width: 100%;
  height: 356px;
}
.advisory1 img{
  width: 100%;
  height: 100%;
}
.checktitle{
  margin-top: 10px;
}

</style>
